package com.zr.subclass.mapper;

import com.zr.subclass.pojo.SubClassSelectVo;
import com.zr.subclass.pojo.SubClassVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by Lenovo on 2019/12/22.
 */
@Mapper
public interface SubClassMapper {
    @Select("select count(id) from planClass where code=#{code}")
    int queryByCode(String code);

    @Select("select count(id) from planClass where name=#{name}")
    int queryByName(String name);

    @Insert("insert into planClass(code,name,remark,status,createName,createTime,updateName,updateTime) " +
            "values(#{code},#{name},#{remark},#{status},#{createName},#{createTime},#{updateName},#{updateTime})")
    void add(SubClassVo planClassVo);

    @Select("select * from planClass where id=#{id}")
    SubClassVo queryById(Integer id);

    @Select("update planClass set name=#{name},remark=#{remark},status=#{status},updateName=#{updateName},updateTime=#{updateTime} " +
            "where id=#{id}")
    void update(SubClassVo planClass);

    @Select("update planClass set status=#{status},updateName=#{updateName},updateTime=#{updateTime} " +
            "where id=#{id}")
    void updateStatus(SubClassVo planClassVo1);

    int queryCount(SubClassSelectVo planClassSelectVo);

    List<SubClassVo> queryData(SubClassSelectVo planClassSelectVo);
}
